package com.kdgc.power.gen;


import java.io.IOException;

import lombok.Getter;
import org.beetl.core.Configuration;
import org.beetl.core.GroupTemplate;
import org.beetl.core.resource.ClasspathResourceLoader;
import org.beetl.sql.gen.BaseProject;
import org.beetl.sql.gen.Entity;
import org.beetl.sql.gen.SourceBuilder;
import org.beetl.sql.gen.SourceConfig;

public abstract   class TemplateSourceBuilder extends SourceBuilder {
    @Getter
    protected static GroupTemplate groupTemplate = initTemplateEngine();

    public  TemplateSourceBuilder(String name) {
        super(name);
    }



    protected static GroupTemplate initTemplateEngine() {
        ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("templates/");
        Configuration cfg = null;
        try {
            cfg = Configuration.defaultConfiguration();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }

        return new GroupTemplate(resourceLoader, cfg);
    }

}
